#include "SequentialStack.h"

void test1() {
    SequentialStack *stack = init_stack();
    // push(stack, 1);
    // printf("top: %d\n", top(stack));
    printf("size: %d\n", size(stack));
    for (int i = 0; i < 10; ++i) {
        push(stack, i);
    }
    printf("top: %d\n", top(stack));
    printf("size: %d\n", size(stack));
    pop_all(stack);
    clear_stack(stack);
}

void test2() {
    SequentialStack *stack = init_stack();
    push(stack, 1);
    pop_all(stack);
    printf("is_empty: %d\n", is_empty(stack));
    push(stack, 2);
    pop_all(stack);
    printf("is_empty: %d\n", is_empty(stack));
    clear_stack(stack);
}

void test3() {
    SequentialStack *stack = init_stack();
    push(stack, 1);
    push(stack, 2);
    clear_stack(stack);
    printf("is_empty: %d\n", is_empty(stack));
    stack = init_stack();
    push(stack, 1);
    push(stack, 2);
    pop_all(stack);
    printf("is_empty: %d\n", is_empty(stack));
    clear_stack(stack);
}

int main() {
    void (*test[])() = {test1, test2, test3};
    int len = sizeof(test) / sizeof(*test);
    for (int i = 0; i < len; ++i) {
        printf("test %d:\n", i + 1);
        test[i]();
    }
}